package com.plian.system.service.fr.organzationmonthratio;

import com.plian.Tools.pagedata.PageData;
import com.plian.system.dao.fr.organzationmonthratio.OrganzationMonthRatioDao;
import com.plian.system.entity.fr.organzationmonthratio.OrganzationMonthRatio;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 说明：单位每月的存贷比和综合融资率
 */
@Service
@Transactional
public class OrganzationMonthRatioService{

    @Autowired
    OrganzationMonthRatioDao organzationMonthRatioDao;

    private static final Logger LOGGER = LoggerFactory.getLogger(OrganzationMonthRatioService.class);

    public void insert(OrganzationMonthRatio organzationMonthRatio) throws Exception {
        organzationMonthRatioDao.save(organzationMonthRatio);
    }
    public void edit(OrganzationMonthRatio organzationMonthRatio) throws Exception{
        organzationMonthRatioDao.edit(organzationMonthRatio);
    }

    /**
     * 根据月份和单位代码返回存贷比，综合融资率信息
     * @param pageData
     * @return
     * @throws Exception
     */
    public OrganzationMonthRatio findByMonthAndOrgcode(PageData pageData) throws  Exception{
        return organzationMonthRatioDao.findByMonthAndOrgcode(pageData);
    }

    /**
     * 根据月份和父节点返回单位和存款信息
     * @param pageData
     * @return
     * @throws Exception
     */
    public List<OrganzationMonthRatio> getInfoByPorgId(PageData pageData) throws Exception{
        return organzationMonthRatioDao.getInfoByPorgId(pageData);
    }
}
